Ext.onReady(function(){
	   
	   var documentTypeStore = Ext.create('Ext.data.Store', {
		    fields: ['value', 'name'],
		    data :documentType
		});
		var gridStore = Ext.create('Ext.data.Store', {
		    fields: ["memberName","documentType","documentNumber","mobile"],
		    //是否在服务端排序 （true的话，在客户端就不能排序）
		    remoteSort: false,
		    proxy: {
		        type: 'ajax',
		        url: contextPath+'/customer/familyMember/findList',
		        reader: {   //这里的reader为数据存储组织的地方，下面的配置是为json格式的数据，例如：[{"total":50,"rows":[{"a":"3","b":"4"}]}]
		            type: 'json', //返回数据类型为json格式
		            root: 'obj'
		        },
		        actionMethods: {read: 'POST'},
		        extraParams:{
		        	memberType:'9',
		        	buyId:businessAbnormaId
		        	
		        }
		    },
		    autoLoad:true
		});
		var columns_2 = [{
			text : "姓名",
			dataIndex : 'memberName',
			width:'20%'
		}, {
			text : "证件类型",
			dataIndex : 'documentType',
			width:'20%',
			editor: new Ext.form.field.ComboBox({
			    store: documentTypeStore,
			    queryMode: 'local',
			    displayField: 'name',
			    valueField: 'value',
           }),
           renderer: function(value,metadata,record){  
               var index = documentTypeStore.find('value',value);  
               if(index!=-1){  
                   return documentTypeStore.getAt(index).data.name;  
               }  
               return value;  
           }
		}, {
			text : "证件号码",
			dataIndex : 'documentNumber',
			width:'20%'
		},{
			text : "手机号码",
			dataIndex : 'mobile',
			width:'20%'
			
		}];

		var row_2=Ext.create('Ext.grid.Panel', {
			titleAlign:'left',
			title:"原共同购房者",
			minHeight:200,
			colspan:1,
			columnLines: true,
	        viewConfig: {
	            stripeRows: true
	        },
			store : gridStore,
			columns : columns_2,
		});
		
		var gridStore4 = Ext.create('Ext.data.Store', {
		    fields: ["memberName","documentType","documentNumber","mobile"],
		    //是否在服务端排序 （true的话，在客户端就不能排序）
		    remoteSort: false,
		    proxy: {
		        type: 'ajax',
		        url: contextPath+'/customer/familyMember/findList',
		        reader: {   //这里的reader为数据存储组织的地方，下面的配置是为json格式的数据，例如：[{"total":50,"rows":[{"a":"3","b":"4"}]}]
		            type: 'json', //返回数据类型为json格式
		            root: 'obj'
		        },
		        actionMethods: {read: 'POST'},
		        extraParams:{
		        	memberType:'7',
		        	buyId:businessAbnormaId
		        }
		    },
		    autoLoad:true
		});
		
		var columns_4 = [{
			text : "姓名",
			dataIndex : 'memberName',
			width:'30%'
		}, {
			text : "证件类型",
			dataIndex : 'documentType',
			width:'30%',
			editor: new Ext.form.field.ComboBox({
			    store: documentTypeStore,
			    queryMode: 'local',
			    displayField: 'name',
			    valueField: 'value',
           }),
           renderer: function(value,metadata,record){  
               var index = documentTypeStore.find('value',value);  
               if(index!=-1){  
                   return documentTypeStore.getAt(index).data.name;  
               }  
               return value;  
           }
		}, {
			text : "证件号码",
			dataIndex : 'documentNumber',
			width:'30%'
		},{
			text : "手机号码",
			dataIndex : 'mobile',
			width:'30%',
		}];

		var row_4=Ext.create('Ext.grid.Panel', {
			titleAlign:'left',
			title:"原客户信息",
			minHeight:200,
			colspan:1,
			columnLines: true,
	        viewConfig: {
	            stripeRows: true
	        },
			store : gridStore4,
			columns : columns_4,
		});
		
		var newGridStore = Ext.create('Ext.data.Store', {
		    fields: ["memberName","documentType","documentNumber","mobile"],
		    //是否在服务端排序 （true的话，在客户端就不能排序）
		    remoteSort: false,
		    proxy: {
		        type: 'ajax',
		        url: contextPath+'/customer/familyMember/findList',
		        reader: {
		            type: 'json', //返回数据类型为json格式
		            root: 'obj'
		        },
		        actionMethods: {read: 'POST'},
		        extraParams:{
		        	memberType:'5',
		        	buyId:businessAbnormaId
		        }
		    },
		    autoLoad:true
		});
		
		
		var columns_3 = [{
			text : "姓名",
			dataIndex : 'memberName',
			width:'25%',
			editor: {
               xtype: 'textfield'
           }
		}, {
			text : "证件类型",
			dataIndex : 'documentType',
			width:'25%',
            renderer: function(value,metadata,record){  
               var index = documentTypeStore.find('value',value);  
               if(index!=-1){  
                   return documentTypeStore.getAt(index).data.name;  
               }  
               return value;  
            }
		}, {
			text : "证件号码",
			dataIndex : 'documentNumber',
			width:'25%'
		},{
			
			text : "手机号码",
			dataIndex : 'mobile',
			width:'20%'
		}];
		
		var row_3=Ext.create('Ext.grid.Panel', {
			titleAlign:'left',
			title:"新共同购房者",
			minHeight:200,
			colspan:1,
			columnLines: true,
	        viewConfig: {
	            stripeRows: true
	        },
			store : newGridStore,
			columns : columns_3
		});
		
		var newGridStore2 = Ext.create('Ext.data.Store', {
		    fields: ["memberName","documentType","documentNumber","mobile"],
		    //是否在服务端排序 （true的话，在客户端就不能排序）
		    remoteSort: false,
		    proxy: {
		        type: 'ajax',
		        url: contextPath+'/customer/familyMember/findList',
		        reader: {
		            type: 'json', //返回数据类型为json格式
		            root: 'obj'
		        },
		        actionMethods: {read: 'POST'},
		        extraParams:{
		        	memberType:'8',
		        	buyId:businessAbnormaId
		        }
		    },
		    autoLoad:true
		});
		
		var columns_5 = [{
			text : "姓名",
			dataIndex : 'memberName',
			width:'25%',
			editor: {
               xtype: 'textfield'
           }
		}, {
			text : "证件类型",
			dataIndex : 'documentType',
			width:'25%',
            renderer: function(value,metadata,record){  
               var index = documentTypeStore.find('value',value);  
               if(index!=-1){  
                   return documentTypeStore.getAt(index).data.name;  
               }  
               return value;  
           }
		}, {
			text : "证件号码",
			dataIndex : 'documentNumber',
			width:'25%'
		},{
			text : "手机号码",
			dataIndex : 'mobile',
			width:'25%'
       }];
		
		var row_5=Ext.create('Ext.grid.Panel', {
			titleAlign:'left',
			title:"新客户信息",
			minHeight:200,
			colspan:1,
			columnLines: true,
	        viewConfig: {
	            stripeRows: true
	        },
			store : newGridStore2,
			columns : columns_5
			
		});
		
        var processHistoryPanel=Ext.create('component.proces.history',{
            processInstanceId: procInstId,
            minHeight:100,
            colspan:2,
			 contextPath:contextPath
       });
       processHistoryPanel.setAutidStatusName(auditStatus);
       processHistoryPanel.setProcesHistoryVisible(processFlag);
       
	   var fileAttachment = Ext.create('component.file.attachment',{
	        objectId: businessAbnormaId,
	        imageType: "6",
	        contextPath:contextPath,
	        colspan:2
	   });
		
	   var fromPanelInfo = Ext.create('Ext.form.FormPanel',{
		    renderTo:Ext.getBody(),
		    titleAlign:'center',
	        title:'更名审批单',
		    border: true,
		    layout:{
		    	 type: 'table',
                 columns: 2,
                 tableAttrs: {　　//在这儿控制table标签中的Attrs属性
                     border: 1,
                     cellpadding: 5,
                     cellspacing: 1,
                     width: '95%',
                     align: 'center',
                     style: "border:1px solid gray;border-collapse:collapse;margin:0 auto;text-align:center;"
                 },
                 tdAttrs: {　　//控制td标签的属性，以上用法都是在ext的api中查到，同样的方式可以给tr添加属性
                     width: '100px',
                     height: '40px',
                     style: "padding:5px",
                     valign: 'middle'
                 }
		    },
			 items:[{
				    xtype:'displayfield',
				    fieldLabel: '合同编号',
				    name: 'signCode'
				},{
				    xtype:'displayfield',
				    fieldLabel: '业务类型',
				    name: '',
				    value:'签约'
				},{
				    xtype:'displayfield',
				    fieldLabel: '房产名称',
				    name: 'roomName'
				},{
				    xtype:'displayfield',
				    fieldLabel: '客户姓名',
				    name: 'customerName'
				},{
				    xtype:'displayfield',
				    fieldLabel: '计价面积(㎡)',
				    name: 'calculateArea'
				},{
				    xtype:'displayfield',
				    fieldLabel: '折前单价(元)',
				    name: 'conversionPrice'
				},{
				    xtype:'displayfield',
				    fieldLabel: '折前总价(元)',
				    name: 'lumpsumPrice'
				},{
				    xtype:'displayfield',
				    fieldLabel: '业务明细',
				    name: 'businessDetail'
				},row_4,row_5,row_2,row_3,{
				    xtype:'displayfield',
				    fieldLabel: '更名原因',
				    name: 'remark',
				    width:780,
				    align: 'left',
				    id:'reason',
				    colspan:2,
				    allowBlank:false,
			    	blankText:'不能为空'
				},{
				    xtype:'displayfield',
				    fieldLabel: '经纪人',
				    name: 'userName'
				},{
				    xtype:'displayfield',
				    fieldLabel: '申请日期',
				    name: 'tcCreateTime'
				},processHistoryPanel,fileAttachment],
				dockedItems: [{
		            xtype: 'toolbar',
		            dock: 'bottom',
		            ui: 'footer',
		            layout: {
		                pack: 'center'
		            },
		            items: [
		            {
						xtype: "button",
						text : "返回",
						id: "btn_back",
						name: "btn_back",
						icon : contextPath + '/resources/ExtJSicons/shape_move_backwards.png',
						listeners: {
							click: function(){
								history.go(-1);
							}
						}
					}]
		        }
		        ]
	   });
	   
	   fromPanelInfo.getForm().load({
			url:contextPath+'/customer/signed/loadCheckOutInfo',
			params:{'signedId':signedId,businessAbnormaId:businessAbnormaId},
			success:function(form, action){
				var obj = action.result.data;
				 var result=Ext.JSON.decode(obj);
				fromPanelInfo.getForm().setValues(result);
				var showUrl = contextPath+"/customer/signed/toView?id="+signedId+"&returnUrl=,marketing,pin,index&processFlag=processHistoryShow";
				var herf = "<a href="+showUrl+" target= '_blank'>业务明细</a>";
				fromPanelInfo.getForm().findField("businessDetail").setValue(herf);
			},   
			failure: function(form, action) {
		        Ext.Msg.alert("加载失败", action.result.errorMessage);
		    }

		});
	  
});